import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['Kaitt', 'SimHei']
# Define the data for the severity of defects
labels = 'A-严重影响系统运行的错误', 'B-功能方面一般缺陷，影响系统运行', 'C-不影响运行但必须修改', 'D-合理化建议'
sizes = [11, 15, 16, 12]  # Sum of each category from the given table above

# Define colors and explode (to highlight a slice if needed)
colors = ['#ff9999','#66b3ff','#99ff99','#ffcc99']
explode = (0.1, 0, 0, 0)  # explode 1st slice

# Plot
plt.figure(figsize=(8, 6))
plt.pie(sizes, explode=explode, labels=labels, colors=colors, autopct='%1.1f%%', startangle=140)
plt.axis('equal')  # Equal aspect ratio ensures that pie is drawn as a circle.
plt.title("缺陷分析按严重程度分类的饼状图")
plt.show()